#include<bits/stdc++.h>
using namespace std;
int r[100005];
bool v[100005];
bool d[100005];
int cnt1,cnt2,cnt0;
bool cmp(int x,int y){
    return x<=y;
}
int main(){
    freopen("duel.in","w",stdin);
    freopen("duel.out","r",stdout);
    int n;
    cin>>n;
    int ans=n;
    int f=1,fl=1;
    for(int i=1;i<=n;i++){
        cin>>r[i];
        if(r[i]>2){
            f=0;
        }
    }
    for(int i=1;i<n;i++){
        if(r[i]!=r[i+1]){
            fl=0;
            break;
        }
    }
    if(fl){
        cout<<n;
        return 0;
    }
    sort(r+1,r+n+1);
    if(f){
        for(int i=1;i<=n;i++){
            if(r[i]==0)cnt0++;
            if(r[i]==1)cnt1++;
            if(r[i]==2)cnt2++;
        }
        int k=min(cnt0,cnt1);
        ans-=k;

        ans-=min((cnt0+cnt1-k),cnt2);
        cout<<ans;
        return 0;
    }
    else{
        for(int i=1;i<n;i++){
            int j=i+1;
            if(d[i]==1)continue;
            int x=1;
            while(r[j]<=r[i]||v[j]==1){
                j++;
                if(j>n){
                    x=0;
                    break;
                }
            }
            if(x==0)continue;
            if(r[j]>r[i]&&v[j]!=1&&d[i]!=1){
                d[i]=1;
                v[j]=1;
                ans--;
            }
        }
        cout<<ans;
    }
    return 0;
}
